import numpy as np
import cv2 as cv
import cv2
from PIL import Image

def test():
    img = Image.open('6.jpeg') # 读取图片
    img = img.convert('L') # 灰度化
    # img = cv2.threshold(6.jpeg, 127, 255, cv2.THRESH_BINARY)
    cols,rows = img.size # 图像大小

    Value = [[0]*rows for i in range(cols)] # 创建一个大小与图片相同的二维数组

    for x in range(0,cols):
        for y in range(0,rows):
            img_array = np.array(img)
            v = img_array[x,y] # 获取该点像素值
            Value[x][y] = v # 存入数组

if __name__ == '__main__':
	test()
print("ok")

